#include "GameObject.h"

//TEMP:
#include "../SGD Wrappers/CSGD_Direct3D.h"
#include "Camera.h"

GameObject::GameObject(void)
{
	objectID = -1;
	imageID = -1;
	isActive = true;
	CheckpointActive = false;
	isCrushing = 0.0f;
	maxHeight = 0;
}


GameObject::~GameObject(void)
{
}

void GameObject::Update(float deltaTime)
{

}
void GameObject::Render(void) const
{
#if DEBUG_COLLISION
		RECT box = hitBox;
		box.left = (int)(box.left - Camera::GetInstance()->OffsetX());
		box.right = (int)(box.right - Camera::GetInstance()->OffsetX());
		box.bottom = (int)(box.bottom - Camera::GetInstance()->OffsetY());
		box.top = (int)(box.top - Camera::GetInstance()->OffsetY());

		CSGD_Direct3D::GetInstance()->DrawHollowRect(box,D3DCOLOR_ARGB(255,255,0,0));
#endif
	if(imageID != -1)
	{
		CSGD_TextureManager::GetInstance()->Draw(imageID,
			(int)(positionX - Camera::GetInstance()->OffsetX()),
			(int)(positionY - Camera::GetInstance()->OffsetY()));
	}
}

RECT GameObject::GetHitBox() const
{
	return hitBox;

}
void GameObject::SetHitBox(RECT hitbox)
{
	this->hitBox = hitbox;
}

void GameObject::SetStartPosition(float x, float y)
{
	startPosition.x = (long)x;
	startPosition.y = (long)y;
}

void GameObject::SetCheckPointData()
{
}

void GameObject::HandleCollision(GameObject& other, CollisionInfo& info)
{

}

void GameObject::SetPosX(float posx)
{
	positionX = posx;
}
void GameObject::SetPosY(float posy)
{
	positionY = posy;
}
void GameObject::SetCanBeGrappled(bool canBeGrappled)
{
	this->canBeGrappled = canBeGrappled;
}
float GameObject::GetPosX( void ) const
{
	return positionX;
}
float GameObject::GetPosY( void ) const
{
	return positionY;
}


int GameObject::GetImageID() const
{
	return imageID;
}

void GameObject::SetImageID(int ID)
{
	imageID = ID;
}

void GameObject::ResetToCheckPoint()
{
	positionX = (float)checkpointPosition.x;
	positionY = (float)checkpointPosition.y;
}

void GameObject::ResetToStart()
{
	positionX = (float)startPosition.x;
	positionY = (float)startPosition.y;
}

bool GameObject::GetIsActive( void ) const
{
	return this->isActive;
}

void GameObject::SetCheckPointIsActive( bool Active )
{
	this->CheckpointActive = Active;
}

void GameObject::SetCheckPointPosition(float x, float y)
{
	this->checkpointPosition.x = (long)x;
	this->checkpointPosition.y = (long)y;
}
